home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include "stdio.h"
- #include "gl.h"
- #include "device.h"
- #include "demograph.h"
-
- #define FMFONT 0
- #define DBUG FALSE
-
- #define Line(x1,y1,x2,y2) sboxfi((x1),(y1),(x2),(y2))
-
- extern CATEGORY *curcategory;
- extern WINREC winrec;
- extern int updatetext;
- extern DATA *curdata;
-
- /* only for eight bitplane kluge */
- extern MACHREC machrec;
-
- extern void (*drawmap)(float *data);
-
- v2ixy(x,y)
- long x,y;
- {
- long vect[2];
- vect[0] = x;
- vect[1] = y;
- v2i(vect);
- }
-
-
- updateslider()
- {
- float range;
- int x, oldx;
- int sminx = winrec.sliderminx;
- int smaxx = winrec.slidermaxx;
- int sminy = winrec.sliderminy;
- int smaxy = winrec.slidermaxy;
- int wid = winrec.sliderwid;
- int orgx = winrec.orgx;
- int orgy = winrec.orgy;
- int minval = sminx + wid;
- int maxval = smaxx - wid;
- long index;
- short val;
-
- #if DBUG
- /* make sure viewport is correct */
- long sizex, sizey;
- getsize(&sizex, &sizey);
- viewport(0,sizex - 1, 0, sizey - 1);
- getorigin(&winrec.orgx, &winrec.orgy);
- ortho2(0.0,(float)(sizex - 1),0.0,(float)(sizey - 1));
- #endif
-
- range = maxval - minval;
- oldx = (winrec.slideroldx * (range) + 0.5) + sminx + wid;
-
- do {
- x = getvaluator(MOUSEX) - orgx;
-
- #if DBUG
- fprintf(stderr,"org %d %d pick %d\n",
- winrec.orgx, winrec.orgy, x);
- #endif
-
- if (x < minval)
- x = minval;
- if (x > maxval)
- x = maxval;
-
- draw_slider(x - wid, sminy, x + wid, smaxy, 0xcc);
- index = (int)((float)((x-minval)*(MAXDATA-1))/range + 0.5);
- curdata = &curcategory->dataarray[index];
- writesliderdate(curdata->date,(float)(x));
- (*drawmap)(curdata->data);
-
- swapbuffers();
-
- /* keep the back buffer clean */
- setcolor(0xbb, 0xbb, 0xbb);
- sboxfi(oldx - wid, sminy, oldx + wid, smaxy);
- oldx = x;
-
- } while(!(qtest() && qread(&val) == LEFTMOUSE && val == UP));
-
- /* unhighlight the slider */
- frontbuffer(TRUE);
- backbuffer(FALSE);
- draw_slider(oldx - wid, sminy, oldx + wid, smaxy, 0xbb);
- writesliderdate(curdata->date,(float)oldx,(float)(smaxy+sminy) / 2.0);
- frontbuffer(FALSE);
- backbuffer(TRUE);
-
- /* write the data values - (need to unscale them) */
- /*
- if (updatetext)
- displaydata(curdata->data);
- */
- /* save the x location - save scale for resize */
- winrec.slideroldx = (float)(oldx - sminx - wid) / (range);
- }
-
-
- draw_slider(minx,miny,maxx,maxy,fillcolor)
- int minx, miny, maxx, maxy, fillcolor;
- {
- int tmp;
-
- setcolor(0,0,0);
- bgnline();
- v2ixy(maxx,miny);
- v2ixy(maxx,maxy);
- endline();
-
- bgnline();
- v2ixy(minx, miny);
- v2ixy(minx, maxy);
- endline();
-
- minx++;
- maxx--;
-
- setcolor(fillcolor,fillcolor,fillcolor);
- sboxfi(minx,miny,maxx,maxy);
-
- setcolor(0xff,0xff,0xff);
- bgnline();
- v2ixy(minx,maxy);
- v2ixy(maxx,maxy);
- endline();
- maxy--;
-
- tmp = miny + 1;
- setcolor(0xee,0xee,0xee);
- bgnline();
- v2ixy(minx,tmp);
- v2ixy(minx,maxy);
- v2ixy(maxx,maxy);
- v2ixy(maxx,tmp);
- endline();
- minx++;
- maxx--;
- maxy--;
-
- setcolor(0x66,0x66,0x66);
- bgnline();
- v2ixy(minx,miny);
- v2ixy(maxx,miny);
- endline();
- miny++;
-
- tmp = miny + 1;
- setcolor(0xdd,0xdd,0xdd);
- bgnline();
- v2ixy(minx,tmp);
- v2ixy(minx,maxy);
- v2ixy(maxx,maxy);
- v2ixy(maxx,tmp);
- endline();
- minx++;
- maxx--;
-
- setcolor(0x88,0x88,0x88);
- bgnline();
- v2ixy(minx,miny);
- v2ixy(maxx,miny);
- endline();
- miny++;
-
- setcolor(0xaa,0xaa,0xaa);
- bgnline();
- v2ixy(minx,miny);
- v2ixy(maxx,miny);
- endline();
- }
-
-
-
-